package general;

import java.io.Serializable;


public class ProductRecord implements Comparable<ProductRecord>, Serializable {
	
	public static int STATE_WAITING = 1;
	public static int STATE_AUCTIONING = 2;
	public static int STATE_AUCTIONED = 3;
	public static int STATE_PAYED = 4;
	public static int STATE_SHIPPED = 5;
	
	private Product fProduct;
	private AuctionOptions fAuctionOptions;
	private int fState;
	
	public ProductRecord(Product product, AuctionOptions auctionOptions, int state) {
		fProduct = product;
		fAuctionOptions = auctionOptions;
		fState = state;
	}
	
	public void setState(int state) {
		fState = state;
	}
	
	public Product getProduct() {
		return fProduct;
	}
	
	public AuctionOptions getAuctionOptions() {
		return fAuctionOptions;
	}
	
	public int compareTo(ProductRecord productRecord) {
		if (fAuctionOptions.getEndTime().before(productRecord.getAuctionOptions().getEndTime())) {
			return -1;
		} else if (fAuctionOptions.getEndTime().equals(productRecord.getAuctionOptions().getEndTime())) {
			return 0;
		}
		return 1;
	}

}
